<#assign pageTitle = "我的资料" />
<#assign pageHeader>
</#assign>
<#assign pageContent>
    <article class="w80 fl">
        <div class="u-r-cont">
            <section>
                <div class="">
                    <section class="u-r-tit-all">
                        <h2 class="unFw">
                            <span <#if status == 0>class="current"</#if>><a
                                        href="/user/document/list.html?status=0">待审核(${notCount})</a></span>
                            <span <#if status == 1>class="current"</#if>><a
                                        href="/user/document/list.html?status=1">已通过(${pastCount})</a></span>
                            <span <#if status == -1>class="current"</#if>><a
                                        href="/user/document/list.html?status=-1">被驳回(${refuseCount})</a></span>
                            <span><a href="/user/document/add.html">上传资料</a></span>
                        </h2>
                    </section>
                    <section class="u-r-all-box">
                        <div class="mem-body">
                            <#if documentList?? && documentList?size gt 0>
                                <table class="member-jl-tab" width="100%" cellspacing="0" cellpadding="0" border="0">
                                    <thead>
                                    <tr>
                                        <th>标题</th>
                                        <th width="150px" align="center">类别</th>
                                        <th width="120px" align="center">状态</th>
                                        <th width="150px" align="center">日期</th>
                                        <th width="180px">操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <#list documentList as item>
                                        <tr>
                                            <td>
                                                <#if item.status == 1>
                                                    <a href="/document/view/${item.id}.html" target="_blank"> ${item.title!}</a>
                                                <#else>
                                                    ${item.title!}
                                                </#if>
                                            </td>
                                            <td>
                                                ${item.categoryName!}
                                            </td>
                                            <td>
                                                <#if item.status == 0>
                                                    <span class="u-ass-dj f-fM">未审核</span>
                                                <#elseif item.status == 1>
                                                    <span class="u-ass-zc f-fM">已通过</span>
                                                    <strong onclick="commentDocument(${item.id})">
                                                        <i style="color:#ff5c38" class="layui-icon layui-icon-dialogue"></i>
                                                    </strong>
                                                <#elseif item.status == -1>
                                                    <span class="u-ass-gq f-fM">被驳回</span>
                                                    <strong onclick="commentDocument(${item.id})">
                                                        <i style="color:#ff5c38" class="layui-icon layui-icon-dialogue"></i>
                                                    </strong>
                                                <#else>
                                                    -
                                                </#if>
                                            </td>
                                            <td>
                                                ${item.createTime?string("yyyy-MM-dd")}
                                            </td>
                                            <td>
                                                <#if item.status  < 1>
                                                    <a href="/user/document/edit.html?id=${item.id!}" title="编辑"
                                                       class="layui-btn layui-btn-primary layui-border-red layui-btn-xs">
                                                        编辑
                                                    </a>
                                                    <a href="javascript:void (0)" onclick="delDocument(${item.id})" title="删除"
                                                       class="layui-btn layui-btn-primary layui-btn-xs">
                                                        删除
                                                    </a>
                                                <#elseif item.status == 1>
                                                    <a href="javascript:void (0)" title="编辑"
                                                       class="layui-btn layui-btn-disabled layui-btn-xs">
                                                        编辑
                                                    </a>
                                                    <a href="javascript:void (0)" title="删除"
                                                       class="layui-btn layui-btn-disabled layui-btn-xs">
                                                        删除
                                                    </a>
                                                </#if>
                                            </td>
                                        </tr>
                                    </#list>
                                    </tbody>
                                </table>
                                <!-- 公共分页 开始 -->
                                <div class="paging" id="showPages"></div>
                                <!-- 公共分页 结束 -->
                            <#else>
                                <section class="no-data-wrap">
                                    <em class="icon30 no-data-ico">&nbsp;</em> <span class="c-666 fsize14 ml10 vam">没有相关数据小编正在努力整理中...  <a
                                                href="/user/document/add.html" class="c-master">马上去上传</a></span>
                                </section>
                            </#if>
                        </div>
                        <!-- 公共分页 开始 -->
                    </section>
                </div>
            </section>
        </div>
    </article>
</#assign>
<#assign pageFooter>
    <script type="text/javascript" src="/static/js/page.js"></script>
    <script type="text/javascript">
        var options = {
            currentPage: ${page.currentPage}
            , totalPage: ${totalPages}
            , status: ${status}
        };
        $(function () {
            showPages(options);
        });

        //删除操作
        function delDocument(id) {
            layer.confirm('删除操作不可逆转，确定要删除该资料吗？', {
                btn: ['确定','取消'] //按钮
            }, function(){
                $.post("/user/document/remove.json", {"id":id}, function (result) {
                    if (result.code === 0) {
                        layer.msg(result.msg, {icon: 1});
                        setTimeout(function () {
                            location.reload()
                        },1200)
                    } else {
                        layer.msg(result.msg, {icon: 2});
                    }
                });
            })
        }

        //评语
        function commentDocument(id) {
            if(id  < 1){
                layer.msg("参数错误", {icon: 2});
                return false;
            }
            var index = layer.open({
                title: '资料评语',
                content: "/user/document/comment.html?id="+id,
                type: 2,
                shade: 0.2,
                maxmin: true,
                shadeClose: true,
                area: ['40%','60%']
            });
        }
    </script>
</#assign>
<#include "../layouts/layout_uc.ftl">